package viewDeLivreur;

import java.awt.GridLayout;
import java.awt.image.BufferedImage;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.*;

import model.TravelPath;


public class VueCarteDirections extends JFrame {
	
	private JButton btnAccepter = new JButton("Accepter");
	private JButton btnRevenir = new JButton("Revenir");
	
	private JPanel general=new JPanel(new GridLayout(1,4));
	private JPanel directions = new JPanel(new GridLayout(0, 1));
	private JPanel carte = new JPanel(new GridLayout(0, 1));
	private JEditorPane ep;
	private JScrollPane scroll;
	private static final long serialVersionUID1 = -3535118786934945940L;
	private static final int CANEVAS_HAUTEUR = 200;
	private static final int CANEVAS_LARGEUR = 400;
	private static final int MARGE_H = 50;
	private static final int MARGE_V = 60;
    
    /**
	 * 
	 */

	public VueCarteDirections(String urlStaticMap, TravelPath tp) throws Exception{
        
        
		
	
		  
		    try {
		      JFrame f = new JFrame("HTMLDocument Structure");
		      //f.setLayout(new GridLayout(2,1));
		      this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		      JEditorPane ep = new JEditorPane();
		      //ep.setSize(600, 570);
		      ep.setContentType("text/html");
		      ep.setText(tp.toString());
		      ep.setEditable(false);
		      
		      
		      BufferedImage image = ImageIO.read(new URL(urlStaticMap));
			JLabel label = new JLabel(new ImageIcon(image));
			scroll = new JScrollPane(ep);
				
			
//			JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, 
//                true, new JScrollPane(ep), label);
//	        
//	        splitPane.setOneTouchExpandable(true);
	        //
			directions.add(scroll);
			carte.add(label);
			general.add(directions);
			general.add(carte);
			
			//f.getContentPane().add(btnAccepter);
		    //f.getContentPane().add(btnRevenir);
	        getContentPane().add(general);
	        
	        
	        
	        
	        //splitPane.setDividerLocation(0.6);
	        
	          
		      //f.getContentPane().add(splitPane);
		     
		      f.setSize(1150, 580);
		      f.setResizable(false);
		      f.setVisible(true);

		      
		    } catch (Exception e) {
		    	
		      System.out.println(e);
		      System.exit(1);
		    }
		  }
    }



